package com.lminkey.servlet;

import com.lmonkey.servic.USERDao;
import com.lmonkey.shop.USER;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.io.IOException;

@WebServlet("/admin/admin_touserupdate")
public class ToUserUpdate extends HttpServlet {
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        request.setCharacterEncoding("UTF-8");
        response.setContentType("text/html;charset=utf-8");

         String id = request.getParameter("id");
        HttpSession session = request.getSession();
        String pw = (String) session.getAttribute("pw");

        //通过id到数据库查找
       USER user = USERDao.selectById(id);
       request.setAttribute("u",user);
       request.setAttribute("cpage",request.getParameter("cp"));
       request.setAttribute("keykords",request.getParameter("keywords"));


       request.getRequestDispatcher("admin_usermodify.jsp").forward(request,response);
    }
}
